<div class="listArea l">
  <div class="grybox">
    <h3>Member List</h3>

    <?php include_partial('global/pager', array('pager' => $pager, 'sort' => array(MemberForm::SORT_FIRST_NAME => 'First Name', MemberForm::SORT_LAST_NAME => 'Last Name', MemberForm::SORT_CREATED_AT => 'Reg. Date'))) ?>

    <div class="listBox" style="clear:both;">
      <div class="listWarp1">Name</div>
      <div class="listWarp1">Email</div>
      <div class="listWarp3">Reg. Date</div>
    </div>
    <div class="listBoxWht">
      <?php if ($pager->getNbResults()) : ?>
      <?php foreach ($pager->getResults() as $user) : ?>
      <div class="frmRow<?php if ($user->getStatus() == Constants::STATUS_INACTIVE) : ?> frmRowInactive<?php endif; ?>">
        <div class="listWarp1"><?php echo $user->getFullName(); ?></div>
        <div class="listWarp1"><?php echo $user->getEmail() ? $user->getEmail() : '&nbsp;'; ?></div>
        <div class="listWarp3"><?php echo StringUtil::getDisplayDate($user->getCreatedAt()); ?></div>
        <div class="editWarp"><a href="<?php echo url_for('@member_edit?id=' . $user->getId()); ?>#f">Edit</a></div>
        <?php if ($user->getStatus() == Constants::STATUS_ACTIVE) : ?><div><a href="<?php echo url_for('@member_list?did=' . $user->getId()); ?>"><img src="/images/admin/icon_cancel.gif" width="12" height="12" alt="Deactive" style="padding-top: 1px;" /></a></div><?php endif; ?>
      </div>
      <?php endforeach; ?>
      <?php endif; ?>
    </div>
  </div>
</div>


<?php if ($member instanceof USER): ?>
<?php
$arrAccountType = array(1 => 'Basic', 2 => 'Facebook', 3 => 'Twitter');
$arrStatesList = STATETable::getInstance()->findAllArray();
$arrGender = StringUtil::getGenderArray();
?>
<form class="f" action="?#f" method="POST">
  <div class="grybox">
    <h1><?php if (isset($isEdit)) : ?>Edit<?php else : ?>Add<?php endif; ?> Member</h1>
    <div class="fmArea">
      <?php echo include_partial('global/errorsList', array('forms' => array($form), 'global' => $errorCollector)); ?>
      <?php if ($sf_request->hasParameter('success')) : ?><div class="succDis"><?php echo LangUtil::getText('message_save_success'); ?></div><?php endif; ?>

      <div class="singleColumn">
        <h2></h2>
        
        <div class="frmRow">
          <label class="frmLable">First Name</label>
          <div class="frmLableValue"><?php echo $member->getFirstName(); ?></div>
        </div>
        <div class="frmRow">
          <label class="frmLable">Last Name</label>
          <div class="frmLableValue"><?php echo $member->getLastName(); ?></div>
        </div>
        <?php if ($member->getUsername() && $member->getType() == Constants::USER_TYPE_BASIC_ACCOUNT) : ?>
        <div class="frmRow">
          <label class="frmLable">Username</label>
          <div class="frmLableValue"><?php echo $member->getUsername(); ?></div>
        </div>
        <?php endif; ?>
        <div class="frmRow">
          <label class="frmLable">Email</label>
          <div class="frmLableValue"><?php echo $member->getEmail(); ?></div>
        </div>
        <?php if ($member->getAddress()) : ?>
        <div class="frmRow">
          <label class="frmLable">Address</label>
          <div class="frmLableValue"><?php echo $member->getAddress(); ?></div>
        </div>
        <?php endif; ?>
        <?php if ($member->getCity()) : ?>
        <div class="frmRow">
          <label class="frmLable">City</label>
          <div class="frmLableValue"><?php echo $member->getCity(); ?></div>
        </div>
        <?php endif; ?>
        <?php if ($member->getStateId()) : ?>
        <div class="frmRow">
          <label class="frmLable">State</label>
          <div class="frmLableValue"><?php echo $arrStatesList[$member->getStateId()]; ?></div>
        </div>
        <?php endif; ?>
        <?php if ($member->getPostCode()) : ?>
        <div class="frmRow">
          <label class="frmLable">Post Code</label>
          <div class="frmLableValue"><?php echo $member->getPostCode(); ?></div>
        </div>
        <?php endif; ?>
        <?php if ($member->getPhone()) : ?>
        <div class="frmRow">
          <label class="frmLable">Phone</label>
          <div class="frmLableValue"><?php echo $member->getPhone(); ?></div>
        </div>
        <?php endif; ?>
        <?php if ($member->getGender()) : ?>
        <div class="frmRow">
          <label class="frmLable">Gender</label>
          <div class="frmLableValue"><?php echo $arrGender[$member->getGender()]; ?></div>
        </div>
        <?php endif; ?>
        <?php if ($member->getDateOfBirth()) : ?>
        <div class="frmRow">
          <label class="frmLable">Date of Birth</label>
          <div class="frmLableValue"><?php echo $member->getDateOfBirth(); ?></div>
        </div>
        <?php endif; ?>
        <?php if ($member->getIpAddress()) : ?>
        <div class="frmRow">
          <label class="frmLable">IP Address</label>
          <div class="frmLableValue"><?php echo $member->getIpAddress(); ?></div>
        </div>
        <?php endif; ?>
        <div class="frmRow">
          <label class="frmLable">Type</label>
          <div class="frmLableValue"><?php echo $arrAccountType[$member->getType()]; ?></div>
        </div>
        <div class="frmRow">
          <label class="frmLable">Member Since</label>
          <div class="frmLableValue"><?php echo StringUtil::getDisplayDate($member->getCreatedAt()) ?></div>
        </div>
        <?php if ($member->getLastLoginAt()) : ?>
        <div class="frmRow">
          <label class="frmLable">Last Seen</label>
          <div class="frmLableValue"><?php echo StringUtil::getDisplayDate($member->getLastLoginAt()); ?></div>
        </div>
        <?php endif; ?>
        <div class="frmRow">
          <label class="frmLable">Status</label>
          <div class="frmtxtBox"><?php echo $form[MemberForm::FIELD_STATUS]->render(array('class'=>'drpBox1')); ?></div>
        </div>
      </div>

      <div class="butArea">
        <input name="" type="submit" class="buttnSrh11" value="Save Changes" />
      </div>

    </div>
  </div>
  <?php echo $form['_csrf_token']->render(); ?>
</form>
<?php endif; ?>